#!/bin/bash
#set -n
#set -x
if [[ (-z "$I") || (-z "${NO_SET+x}") ]] ; then
#   echo "Executing $HOME/bin/setupenv.sh"
	if [[ -z "$I" ]] ; then
		. $HOME/bin/setupenv.sh $*
	else
		. $I/setupenv.sh $*
	fi
fi
if [[ -z "$is_cygwin" ]] ; then
	. $I/setopsys.sh
fi
if (( is_cygwin == 1 )) ; then
	setupddwnenv local_drive "C:"
	setupddwnenv opt_tools "${local_drive}/opt/tools"
    export CVS_LOC=/bin
	if (( is_vista == 1 )) ; then
		setupddwnenv app_data "/Users/$USER"
		setupddwnenv sapp_data "${local_drive}\\Users\\$USER"
		win_dir=Windows
		setupddwnenv java_home "${opt_tools}/Sun/SDK/jdk"
	else
		setupddwnenv app_data "/DOCUME~1/$USER"
		setupddwnenv sapp_data "${local_drive}\\DOCUME~1\\$USER"
		win_dir=WINDOWS
		setupddwnenv java_home "${local_drive}/PROGRA~1/Java/jdk1.5.0_10"
	fi
	export TEMP="${sapp_data}\\LOCALS~1\\Temp"
	export TMP="${sapp_data}\\LOCALS~1\\tmp"
	export win_dir_root=/$win_dir/system32
	export win_path=/cygdrive/c$win_dir_root
#export PATH="$(echo $PATH | sed -e "s^/cygdrive/c/$win_dir/system32:^^g" )"
	export PATH="$(echo $PATH | sed -e "s^$win_path:^^g" )"
	export SystemPath=/$win_dir
	setupddwnenv wtk251 /opt/WTK2.5.1
	setupddwnenv j2mewtk "$app_data/j2mewtk/2.5.2/apps"
	setupddwnenv ext_drive e:
	setupddwnenv wtk_wme_home "${local_drive}/PROGRA~1/IBM/WEME/571/PalmOS50/Tools"

	setupddwnenv class_sep ";"
	if (( is_vista == 1 )) ; then
		setupddwnenv wtk252 "${opt_tools}/WTK2.5.2"
	else
		setupddwnenv wtk252 "/opt/WTK2.5.2"
	fi
	setupddwnenv netbeans_home "/opt/NETBEANS~1.1"
    #setupddwnenv netbeans_mobility_suffix "8"
	setupddwnenv netbeans_mobility_suffix ""
else
	setupddwnenv local_drive ""
	setupddwnenv opt_tools "${HOME}opt/opt/tools"
	export CVS_LOC=/bin
	setupddwnenv app_data "$HOME"
	setupddwnenv sapp_data "$app_data"
	setupddwnenv java_home "/usr/share/jdk1.6.0_12"
	if [[ ! -f $java_home ]] ; then
		setupddwnenv java_home /usr/lib/jvm/java-6-openjdk
	fi
	export TEMP="/tmp"
	export TMP="/tmp"
	setupddwnenv wtk251 /opt/WTK2.5.1
	setupddwnenv j2mewtk "$HOME/j2mewtk/2.5.2/apps"
	setupddwnenv j2menetbeans "$HOME/NetBeansProjects"
	setupddwnenv ext_drive "/media/KINGSTON_2"
	setupddwnenv wtk252 "/opt/WTK2.5.2"
	setupddwnenv class_sep ":"
	setupddwnenv local_drive ""
	setupddwnenv netbeans_home "/usr/local/netbeans-6.9.1"
    #setupddwnenv netbeans_mobility_suffix "8"
	setupddwnenv netbeans_mobility_suffix ""
fi
setupddwnenv netbeans_wtk_home "${netbeans_home}/mobility${netbeans_mobility_suffix}/WTK2.5.2"
if [[ (-z "$NO_SET") && ("$PATH" = "${PATH%%/usr/bin*}") ]] ; then
	export PATH="$PATH:/usr/bin"
fi
if [[ (-z "$NO_SET") && ("$PATH" = "${PATH%%$JAVA_HOME*}") ]] ; then
	export PATH="$JAVA_HOME/bin:$PATH"
fi
setupddwnenv jdk_home $JAVA_HOME
setupddwnenv JDEPEND_HOME "${opt_tools}/jdepend/jdepend-2.9"
setupddwnenv bea_home "${local_drive}/opt/bea"
export WL_HOME=$BEA_HOME/weblogic92
setupddwnenv weblogic $WL_HOME
#export ANT_HOME=$WL_HOME/server
#setupddwnenv ant_home ${opt_tools}/apache-ant/apache-ant-1.7.1
#setupddwnenv ant_home ${opt_tools}/apache-ant/apache-ant-1.8.0
setupddwnenv ant_home ${opt_tools}/apache-ant/apache-ant-1.8.1
if [[ (-z "$NO_SET") && ("$PATH" = "${PATH%%$ANT_HOME*}") ]] ; then
	export PATH="$ANT_HOME/bin:$PATH"
fi
setupddwnenv wtk_home "$wtk252"
setupddwnenv wtk_app_home "$wtk_app_home/apps"
setupddwnenv wtk251_app_home "$wtk251/apps"
export WPATH="$WL_HOME/server/lib/weblogic.jar;\
$WL_HOME/server/lib/webservices.jar"
setupddwnenv mrss "$wtk251_app_home/RSSReader/mobile-rss-reader"
setupddwnenv mrssb "$wtk251_app_home/RSSReadero/mobile-rss-reader/1.11.1"
setupddwnenv mrssc "$wtk251_app_home/RSSReaderold/mobile-rss-reader"
setupddwnenv mowa "$wtk251_app_home/Oware/oware-midlet"
setupddwnenv mjlo "$wtk251_app_home/JLogMicro/jlogmicro"
setupddwnenv rev "$wtk251_app_home/Reversi/mobilesuite"
setupddwnenv rss "$j2mewtk/RSSReader"
setupddwnenv rss1 "$rss"
setupddwnenv nrss "$j2menetbeans/RSSReader"
setupddwnenv nrss1 "$nrss"
setupddwnenv rss2 "$j2mewtk/RSSReadero"
setupddwnenv nrss2 "$j2menetbeans/RSSReadero"
setupddwnenv owa "$j2mewtk/Oware"
#set -x
setupddwnenv jlo "$j2mewtk/JLogMicro"
#set +x
setupddwnenv mste1 "$j2mewtk/NewsReader"
setupddwnenv mste "$wtk251_app_home/NewsReader/mobilesuite"
setupddwnenv sjlo "$wtk251_app_home/JLogMicro/jlogmicro"
setupddwnenv sjlob "$wtk251_app_home/JLogMicroo/jlogmicro/1.11.1"
setupddwnenv jlo "$j2mewtk/JLogMicro"
setupddwnenv jlo1 "$rss"
setupddwnenv jlo2 "$j2mewtk/JLogMicroo"
setupddwnenv srss "$HOME/src/spring-rss-reader"
setupddwnenv mjmunit "$wtk251_app_home/JMUnit/jmunit"
setupddwnenv mjmu "$mjmunit"
setupddwnenv jmunit "$j2mewtk/JMUnit"
setupddwnenv jmu "$jmunit"
export sony=/SONYER~1/JavaME_SDK_CLDC/PC_Emulation/WTK2/apps/JEZContactsDelux/src
export ez=/opt/WTK2.5.1/apps/JEZContactsDelux/src
setupddwnenv findbugs_home ${opt_tools}/findbugs-1.3.4
setupddwnenv dependencyfinder_home ${opt_tools}/DependencyFinder/DependencyFinder-1.2.1-beta3
setupddwnenv CLASSPATH "$CLASSPATH\
${class_sep}/var/opt/bea/user_projects/crelse/$USER/cmain/lib/junit-4.2.jar"
setupddwnenv CLASSPATH "$CLASSPATH${class_sep}${opt_tools}/bcel-5.2/bcel-5.2.jar"
setupddwnenv CLASSPATH "$CLASSPATH${class_sep}${opt_tools}/bsh-2.0b4/bsh-2.0b4.jar"
setupddwnenv s60_home ${ext_drive}/opt/S60/devices/S60_3rd_FP2_SDK_v1.1
setupddwnenv s60_chome /cygdrive/f/opt/S60/devices/S60_3rd_FP2_SDK_v1.1
setupddwnenv s60_ebin ${ext_drive}/opt/S60/devices/S60_3rd_FP2_SDK_v1.1/epoc32/tools
setupddwnenv s60_cebin /cygdrive/f/opt/S60/devices/S60_3rd_FP2_SDK_v1.1/epoc32/tools
setupddwnenv s60t_home "${ext_drive}/opt/CSL Arm Toolchain"
setupddwnenv s60t_bin "${ext_drive}/opt/CSL Arm Toolchain/bin"
setupddwnenv aperl_bin "C:/Perl/bin"
setupddwnenv caperl_bin "/cygdrive/c/Perl/bin"
setupddwnenv hello_home $s60_home/S60CppExamples/helloworldbasic
setupddwnenv hello_chome $s60_chome/S60CppExamples/helloworldbasic
setupddwnenv catalina_home ${ext_drive}/opt/tools/apache/apache-tomcat-6.0.18
setupddwnenv maven_home ${ext_drive}/mostdownloads/gnu/apache/maven/apache-maven-2.0.9
setupddwnenv maven_home ${ext_drive}/mostdownloads/gnu/apache/maven/apache-maven-2.0.9
if [[ "$PATH" = "${PATH%%$DEPENDENCYFINDER_HOME*}" ]] ; then
	export PATH="$PATH:$DEPENDENCYFINDER_HOME/bin"
fi
#If this is defined, we removed the windows path so that we could put JAVA_HOME
#ahead of it to get the java with a specific release.
if [[ -n "$win_path" ]] ; then
	setupddwnenv path "$PATH:$win_path"
fi
#Since we modified path, we need to append it to the end.
if [[ -n "$WRITE" ]] ; then
	setupddwnenv path "$PATH"
fi
